$("#gridDanhSachHangHoa").jqGrid({        
   	url:'/quanlyhanghoa/json/?func=getListHangHoa',
	datatype: "json",
   	colNames:['Mã hàng','Tên hàng', 'Giá bán mặc định', 'Số lượng tồn kho'],
   	colModel:[
   		{name:'id',index:'maHangHoa', width:55, editable:false},
   		{name:'tenHangHoa',index:'tenHangHoa', width:90, editable:true},
   		{name:'giaMacDinh',index:'giaMacDinh', width:80, formatter:"number", align:"right", editable:true},
   		{name:'soLuongTonKho',index:'soLuongTonKho', width:80,align:"right", editable:true}
   	],
   	rowNum:10,
   	rowList:[10,20,30],
   	pager: '#pDanhSachHangHoa',
   	sortname: 'maHangHoa',
    viewrecords: true,
    loadonce: false,
    sortorder: "desc",
	jsonReader: {
		repeatitems : false,
		id: "0"
	},
	caption: "Danh sách hàng hóa",
	width: '971',
    height: '100%',
	editurl:"/quanlyhanghoa/json/?func=updateHangHoa"
});
jQuery("#gridDanhSachHangHoa").jqGrid('navGrid','#pDanhSachHangHoa',
									{
										edit:true,
										add:true,
										del:true
									});

$('#cbbHangHoa').change(function() {
	$("#gridDanhSachHangHoa").jqGrid().setGridParam({url : '/quanlyhanghoa/json/?func=getListHangHoa&maHangHoa=' + $('#cbbHangHoa').val()}).trigger('reloadGrid');
});

$(document).ready(function() {
	
	$('#HangHoa').addClass('Active');
    
});